package general;

import java.util.Scanner;

import javax.swing.JOptionPane;

import charactergear.CharacterItem;

import wowarmory.ImportCharacter;
import wowmmodb.MmoChampionItemImport;

public class Startupshizz {

	private static WarlockAppIntegrator warlockApplicationStarter;
	
	//TEST ONLY!
	private static final String CHARACTER[] = {"Sukkerpa", "Executus", "EU"};
		
	public static void main (String[]args) throws Exception {
		
		//BS START
		Scanner scanner = new Scanner(System.in);
		//BS END
		
		ImportCharacter characterToImport;
		MmoChampionItemImport itemDataToImport = new MmoChampionItemImport();
		
		String jversion = System.getProperty("java.version");
		System.out.println("Detection jvm version: " + jversion);
		System.out.println("Welcome to this WoW-integrated application..\r\n Now Loading..");
		char checkversion = jversion.charAt(2);
		if (checkversion > '6') {
			System.out.println("Please install Java 1.6. Compiler error");
			JOptionPane.showMessageDialog(null, 
					"Your current java \r\n version is too old, please upgrade", 
					"Couldn't start", JOptionPane.ERROR_MESSAGE);
			return;
		}
		
		//BS START
		/*
		System.out.println("Character name please: (e.g Klakaballe)");
		String charName = scanner.nextLine();
		
		System.out.println("Realm name please: (e.g Twisting Nether)");
		String realmName = scanner.nextLine();
		
		System.out.println("Region please: (e.g EU)");
		String regionName = scanner.nextLine();
		
		characterToImport = new ImportCharacter(charName, realmName, regionName);
		*/
		//BS END
		
		characterToImport = new ImportCharacter(CHARACTER[0], CHARACTER[1], CHARACTER[2]);
		
		warlockApplicationStarter = characterToImport.fetchCharacterDataFromWowArmory();
		
		if(warlockApplicationStarter!=null) 
			System.out.println("\r\rCharacter data loaded from WowArmory and mmo-champion..");
		else 
			System.out.println("Something happened during the loading of your character. Please try again..");
		
		System.out.println("\r\rStarting to load itemdata for ");
		
		for(CharacterItem item : warlockApplicationStarter.getWowcharitems()){
			Object fetchItemData = itemDataToImport.retrieveItemData(item.getItemId(), "");
		}
		
		warlockApplicationStarter = new WarlockAppIntegrator();
		//warlockApplicationStarter.startApp(); //launching the application
		
		System.out.println("\r\rCharacter items loaded. Items stored under path://" + System.getProperty("USER_HOME"));
		
	}
}
